{extend name="base/main" /}
{block name="body"}
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>搜索条件</h5>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">一级分类：</label>
            <div class="layui-input-block">
              <select name="name" lay-verify="required">
                <option value="">请选择分类</option>
                {foreach $cate as $key=>$vo}
                <option value="{$vo.id}">{$vo.name}</option>
                {/foreach}
              </select>
            </div>
          </div>
        <div class="layui-inline">
            <label class="layui-form-label">分类名称</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required|phone" autocomplete="off" class="layui-input">
            </div>
            <a href="{:url('subject/index')}" class="layui-btn layui-btn-normal">搜索</a>
        </div>
    </div>
</div>

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-title">
            <h5>二级分类 / 分类列表</h5>
        </div>
        <div class="ibox-content">
            <div class="row row-lg">
                <div class="col-sm-12">
                <div class="fixed-table-toolbar">
                    <div class="bars pull-left" style="margin-top:0px;">
                        <a href="{:url('Classify/index')}" type="button" class="layui-btn">返回一级</a>
                        <a href="{:url('subject/add')}" type="button" class="layui-btn">添加分类</a>
                    </div>
                </div>
                <div class="example-wrap">
                    <div class="example">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th><input type="checkbox" class="i-checks check-all"></th>
                                <th>编号</th>
                                <th>父级分类</th>
                                <th>分类名称</th>
                                <th>图标</th>
                                <th>专题数量</th>
                                <th>排序</th>
                                <th>是否显示</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="data" id="vo"}
                            <tr>
                                <td><input type="checkbox" class="i-checks ids" name="id[]" value="{$vo.id}"/></td>
                                <td>{$vo.id}</td>
                                <td>{$vo.grade_id}</td>
                                <td>{$vo.class_name}</td>
                                <td><img src="{$vo.pic}" width=40px height=40px></td>
                                <td>{$vo.special_count}</td>
                                <td>{$vo.sort}</td>
                                <td>
                                    <input type="checkbox" checked="" name="is_show" lay-skin="switch" lay-filter="switchTest" title="显示">显示
                                </td>
                                <td>
                                    <a href="{:url('subject/edit',['id'=>$vo['id']])}" class="btn btn-info btn-xs"><i class="fa fa-paste"></i> 编辑 </a>
                                    <a href="javascript:void(0);" class="btn btn-danger btn-xs confirm tabledel ajax-post-a" target-form="id" data-id="{$vo.id}" url="{:url('subject/remove',['id'=>$vo['id']])}"><i class="fa fa-trash"></i> 删除 </a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>  
        </div>
    </div>
</div>
</div>
<script>
    layui.use(['form'], function() {
        var form = layui.form
            , layer = layui.layer;
        //监听指定开关
        form.on('switch(switchTest)', function(data){
            layer.msg('显示checked：'+ (this.checked ? 'true' : 'false'), {
                offset: '10px'
            });
            layer.tips( data.othis)
        });
    })
</script>
{/block}